package cn.yunhe.dao.impl;

import cn.yunhe.BaseDB;
import cn.yunhe.dao.ISouDao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class SouDao extends BaseDB implements ISouDao {

    Connection conn=null;
    PreparedStatement psmt=null;
    ResultSet rs=null;

    @Override
    public List<String> getKeyword(String keyword) {
        List<String> list = new ArrayList<>();
        try{
            conn=getConn();
            String sql="select * from tb_liuyan where liu_title like ?";
            psmt=conn.prepareStatement(sql);
            psmt.setString(1,keyword+"%");
            rs=psmt.executeQuery();
            while (rs.next()){
                list.add(rs.getString("liu_title"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }
}
